package com.woniu.controller;

import com.woniu.entity.Result;
import com.woniu.entity.vo.CheckInfoVO;
import com.woniu.pojo.Pattern;
import com.woniu.service.PatternService;
import com.woniu.utils.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author Ma.Lei
 * @description
 * @date 2022/12/29 14:17
 */
@RestController
@RequestMapping("/userRoadCharging")
@Api(tags = "计费模板查询控制类")
public class UserRoadChargingController extends BaseController {

    @Autowired
    private PatternService patternService;

    @ApiOperation("根据路段ID查询收费标准")
    @GetMapping("/listRoadPattern/{roadId}")
    public Result listRoadPattern(@PathVariable String roadId){
        List<Pattern> patternList = patternService.listRoadPattern(roadId);
        if (patternList.size()==0){
            return new Result(500,"无数据或路段编号错误！");
        }
        return toDataResult(patternList);
    }
}
